import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/wawa',
  },
  {
    path: '/wawa',
    component: () => import('@/views/HomeView'),
    children: [{
        path: '',
        redirect: 'default'
      },
      {
        path: 'default',
        component: () => import('@/views/components/Body/home'),
        meta: {
          title: '蛙蛙工具_首页 shouye'
        },
      }, {
        path: 'poetry',
        component: () => import('@/views/components/Body/poetry'),
        meta: {
          title: '蛙蛙工具_一句诗词'
        },
      },
      {
        path: 'encourage',
        component: () => import('@/views/components/Body/encourage'),
        meta: {
          title: '蛙蛙工具_励志句子'
        },
      }, {
        path: 'poison',
        component: () => import('@/views/components/Body/poison'),
        meta: {
          title: '蛙蛙工具_毒鸡汤'
        },
      },

    ]
  },
]

const router = new VueRouter({
  routes,
  mode:'history'
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title;
  next();
})

export default router